package com.pzhu.user.domain.entity.converter;

import com.pzhu.base.common.utils.json.JSONUtils;
import com.pzhu.user.domain.entity.Permission;
import com.pzhu.user.domain.enums.MenuType;
import com.pzhu.user.domain.ro.PermissionCreateRO;
import com.pzhu.user.domain.ro.PermissionUpdateRO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;

@Mapper(
        componentModel = MappingConstants.ComponentModel.SPRING,
        imports = {MenuType.class, JSONUtils.class})
public interface PermissionEntityConverter {

    @Mapping(target = "status", ignore = true)
    @Mapping(target = "permissionDesc", ignore = true)
    @Mapping(target = "id", ignore = true)
    Permission of(PermissionCreateRO ro);

    @Mapping(target = "status", ignore = true)
    @Mapping(target = "permissionDesc", ignore = true)
    @Mapping(target = "id", ignore = true)
    @Mapping(target = "code", ignore = true)
    Permission of(PermissionUpdateRO permissionUpdateRo);
}
